﻿using IQIGame.Onigao.Framework;
using UnityEditor;
using UnityEditor.UI;

namespace IQIGame.Onigao.Game.Editors
{
    [CustomEditor(typeof(ExButton))]
    [CanEditMultipleObjects]
    public class ExButtonEditor : ButtonEditor
    {
        private SerializedProperty _gobjSelected;
        private ExButton exButton;
        protected override void OnEnable()
        {
            base.OnEnable();
            _gobjSelected = serializedObject.FindProperty(nameof(_gobjSelected));
            exButton = target as ExButton;
        }

        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.PropertyField(_gobjSelected);
            serializedObject.ApplyModifiedProperties();
            exButton.eventPassFloor = EditorGUILayout.IntField(FirstUpString(nameof(exButton.eventPassFloor)), exButton.eventPassFloor);
        }

        private string FirstUpString(string str)
        {
            return str.Substring(0, 1).ToUpper() + str.Substring(1);
        }
    }
}

